package com.xiaobai.zhuangxiuguanjia.model;

import android.util.Log;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/15 0015.
 */
public class HeadViewInfo {
    private int version;
    private String action;
    private int errorCode;
    private int allRows;
    private List<HeadViewData> headViewDataList;
    public void parseJSON(JSONObject json){
        version = json.optInt("version");
        action = json.optString("action");
        errorCode = json.optInt("errorCode");
        allRows = json.optInt("allRows");
        headViewDataList = new ArrayList<HeadViewData>();
        JSONArray data = json.optJSONArray("data");
        Log.d("HeadViewInfo","HeadViewInfo:"+data);
        for (int i=0;i<data.length();i++){
            JSONObject jsonObject = data.optJSONObject(i);
            HeadViewData headViewData = new HeadViewData();
            headViewData.parseJSON(jsonObject);
            headViewDataList.add(headViewData);
        }
    }

    public int getVersion() {
        return version;
    }

    public String getAction() {
        return action;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public int getAllRows() {
        return allRows;
    }

    public List<HeadViewData> getHeadViewDataList() {
        return headViewDataList;
    }
}
